<?php
session_start();
include("load-settings.php");

if(!isset($_SESSION['user']))
	header("Location: login.php");

$user = $_SESSION['user'];

$result = mysql_query("SELECT * FROM user WHERE id = $user");
$row = mysql_fetch_array($result);

if(!isset($_GET['order']))
	header("Location: home.php");

$order = mysql_real_escape_string($_GET['order']);

$booster_result = mysql_query("SELECT * FROM booster_order WHERE order_record = $order AND active = 1");
$booster_row = mysql_fetch_array($booster_result);

mysql_query("UPDATE booster_order SET started = 1 WHERE id = ".$booster_row['id']);

$message = "Beginning your order now.";

mysql_query("INSERT INTO order_chat (user, message, timestamp, order_record) VALUES ($user, '$message', ".time().", $order)");

header("Location: ".$_SERVER['HTTP_REFERER']);
?>